package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.GoodsSalesDTO;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.OrderDetail;
import com.sky.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {
    void insert(Orders orders);


    Page<Orders> historyOrders(OrdersPageQueryDTO ordersPageQueryDTO);

    Orders querById(Long id);

    void update(Orders orders);

    Integer countStatus(Integer deliveryInProgress);

    @Select("select * from orders where status = #{status} and order_time < #{now}")
    List<Orders> getStatussAndOrderTime(Integer status, LocalDateTime now);


    BigDecimal sumByCondittion(Integer status, LocalDate date);

    Integer coutByMap(Map param);

    List<GoodsSalesDTO> selectTop10(LocalDate begin, LocalDate end);

}
